﻿#ifndef COMMON_H
#define COMMON_H

#include <stdint.h>
#include <string>
#include <QImage>

class PointDetail
{
public:
    PointDetail() {};
    PointDetail(const std::string &timeStr, uint32_t timestamp, double longitude, double latitude, bool valid) :
        mTimeStr(timeStr), mTimestamp(timestamp), mLongitude(longitude), mLatitude(latitude), mValid(valid){}

    inline std::string timeStr() { return mTimeStr; }
    inline uint32_t timestamp() {  return mTimestamp; }
    inline double x(int mode = 0) {  return (mode == 0) ? mLongitude : mTimestamp; }
    inline double y(int mode = 0) {  return (mode == 0) ? mLatitude : ((mode == 1) ? mLongitude * 100000 : mLatitude * 100000); }

    inline void setValid(bool valid) { mValid += valid ? 1 : -1; }
    inline bool valid() { return mValid > 0; }

    inline void setHighlight(bool highlight) { mHighlight = highlight; }
    inline bool highlight() { return mHighlight; }

private:
    std::string mTimeStr;
    uint32_t mTimestamp;
    double mLongitude;
    double mLatitude;
    int mValid;
    bool mHighlight = false;;
};

typedef struct
{
    bool valid;
    float topleftx;
    float toplefty;
    float bottomrightx;
    float bottomrighty;
    QImage image;
}TiffDetail;

#endif // COMMON_H
